home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libcruft / lapack / zlarf.f < prev    next >
Text File  |  1996-07-19  |  3KB  |  122 lines

  1.       SUBROUTINE ZLARF( SIDE, M, N, V, INCV, TAU, C, LDC, WORK )
  2. *
  3. *  -- LAPACK auxiliary routine (version 2.0) --
  4. *     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
  5. *     Courant Institute, Argonne National Lab, and Rice University
  6. *     September 30, 1994
  7. *
  8. *     .. Scalar Arguments ..
  9.       CHARACTER          SIDE
  10.       INTEGER            INCV, LDC, M, N
  11.       COMPLEX*16         TAU
  12. *     ..
  13. *     .. Array Arguments ..
  14.       COMPLEX*16         C( LDC, * ), V( * ), WORK( * )
  15. *     ..
  16. *
  17. *  Purpose
  18. *  =======
  19. *
  20. *  ZLARF applies a complex elementary reflector H to a complex M-by-N
  21. *  matrix C, from either the left or the right. H is represented in the
  22. *  form
  23. *
  24. *        H = I - tau * v * v'
  25. *
  26. *  where tau is a complex scalar and v is a complex vector.
  27. *
  28. *  If tau = 0, then H is taken to be the unit matrix.
  29. *
  30. *  To apply H' (the conjugate transpose of H), supply conjg(tau) instead
  31. *  tau.
  32. *
  33. *  Arguments
  34. *  =========
  35. *
  36. *  SIDE    (input) CHARACTER*1
  37. *          = 'L': form  H * C
  38. *          = 'R': form  C * H
  39. *
  40. *  M       (input) INTEGER
  41. *          The number of rows of the matrix C.
  42. *
  43. *  N       (input) INTEGER
  44. *          The number of columns of the matrix C.
  45. *
  46. *  V       (input) COMPLEX*16 array, dimension
  47. *                     (1 + (M-1)*abs(INCV)) if SIDE = 'L'
  48. *                  or (1 + (N-1)*abs(INCV)) if SIDE = 'R'
  49. *          The vector v in the representation of H. V is not used if
  50. *          TAU = 0.
  51. *
  52. *  INCV    (input) INTEGER
  53. *          The increment between elements of v. INCV <> 0.
  54. *
  55. *  TAU     (input) COMPLEX*16
  56. *          The value tau in the representation of H.
  57. *
  58. *  C       (input/output) COMPLEX*16 array, dimension (LDC,N)
  59. *          On entry, the M-by-N matrix C.
  60. *          On exit, C is overwritten by the matrix H * C if SIDE = 'L',
  61. *          or C * H if SIDE = 'R'.
  62. *
  63. *  LDC     (input) INTEGER
  64. *          The leading dimension of the array C. LDC >= max(1,M).
  65. *
  66. *  WORK    (workspace) COMPLEX*16 array, dimension
  67. *                         (N) if SIDE = 'L'
  68. *                      or (M) if SIDE = 'R'
  69. *
  70. *  =====================================================================
  71. *
  72. *     .. Parameters ..
  73.       COMPLEX*16         ONE, ZERO
  74.       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ),
  75.      $                   ZERO = ( 0.0D+0, 0.0D+0 ) )
  76. *     ..
  77. *     .. External Subroutines ..
  78.       EXTERNAL           ZGEMV, ZGERC
  79. *     ..
  80. *     .. External Functions ..
  81.       LOGICAL            LSAME
  82.       EXTERNAL           LSAME
  83. *     ..
  84. *     .. Executable Statements ..
  85. *
  86.       IF( LSAME( SIDE, 'L' ) ) THEN
  87. *
  88. *        Form  H * C
  89. *
  90.          IF( TAU.NE.ZERO ) THEN
  91. *
  92. *           w := C' * v
  93. *
  94.             CALL ZGEMV( 'Conjugate transpose', M, N, ONE, C, LDC, V,
  95.      $                  INCV, ZERO, WORK, 1 )
  96. *
  97. *           C := C - v * w'
  98. *
  99.             CALL ZGERC( M, N, -TAU, V, INCV, WORK, 1, C, LDC )
  100.          END IF
  101.       ELSE
  102. *
  103. *        Form  C * H
  104. *
  105.          IF( TAU.NE.ZERO ) THEN
  106. *
  107. *           w := C * v
  108. *
  109.             CALL ZGEMV( 'No transpose', M, N, ONE, C, LDC, V, INCV,
  110.      $                  ZERO, WORK, 1 )
  111. *
  112. *           C := C - w * v'
  113. *
  114.             CALL ZGERC( M, N, -TAU, WORK, 1, V, INCV, C, LDC )
  115.          END IF
  116.       END IF
  117.       RETURN
  118. *
  119. *     End of ZLARF
  120. *
  121.       END
  122.